Here's the definition of a not-profit organization from the IRS:
The exempt purposes set forth in section 501(c)(3) are charitable, religious, educational, scientific, literary, testing for public safety, fostering national or international amateur sports competition, and preventing cruelty to children or animals. The term charitable is used in its generally accepted legal sense and includes relief of the poor, the distressed, or the underprivileged; advancement of religion; advancement of education or science; erecting or maintaining public buildings, monuments, or works; lessening the burdens of government; lessening neighborhood tensions; eliminating prejudice and discrimination; defending human and civil rights secured by law; and combating community deterioration and juvenile delinquency.
The purpose of granting this status is because these organizations are supposed to be working for the good of the community with NO profit motive. I simply disgree with the IRS in their definition of charitable when it includes organizations that advance religion. I think its a direct violation of the 1st amendment because the State has no business advancing any religion. Freedom of religion is an important right but I fail to see how allowing religious organizations amass large amounts of wealth (cash, property, whatever) without paying for the burden they place on the government can be deemed charitable. If they're actually engaged in real charitable activity such as running a homeless shelter, soup kitchen, etc. then fine. Make those funds deductible and tax whatever profit they make.
I realize religious organizations are very powerful and that's the real reason why they are considered charitable. It doesn't make it constitutional or right.